package com.example.service.impl;

import com.example.mapper.oilListMapp;
import com.example.pojo.fixtureListPojo;
import com.example.pojo.fixtureTechConditionPojo;
import com.example.pojo.oilListPojo;
import com.example.service.oilListService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;

/**
 * ClassName:oilListImpl
 * Package:com.example.service.impl
 * Description:
 *
 * @Author：牧星苑
 * @Create 2025/9/23 17:32
 * @Version 1.0
 */
@Service
public class oilListImpl implements oilListService {
    @Autowired
    private oilListMapp oilListMapp;
    //插入一行油液基本信息
    public void insertOne(oilListPojo pojo){
        pojo.setCreate_time(LocalDateTime.now());
        pojo.setUpdate_time(LocalDateTime.now());
        oilListMapp.insertOne(pojo);
    }

    //修改一行油液基本信息
    public void editOneById(oilListPojo pojo){
        pojo.setUpdate_time(LocalDateTime.now());
        oilListMapp.editOneById(pojo);
    }

    //查询所有的油液基本信息
    public List<oilListPojo> queryAll(){
        List<oilListPojo> pojoList = oilListMapp.queryAll();
        return pojoList;
    }

    //查询某三个字段为某值的数据
    public List<oilListPojo> queryThreeFields(Map<String, Object> map){
        String fieldName1 = String.valueOf(map.get("fieldName1"));
        String fieldValue1 = String.valueOf(map.get("fieldValue1"));
        String fieldName2 = String.valueOf(map.get("fieldName2"));
        String fieldValue2 = String.valueOf(map.get("fieldValue2"));
        String fieldName3 = String.valueOf(map.get("fieldName3"));
        String fieldValue3 = String.valueOf(map.get("fieldValue3"));
        List<oilListPojo> oilListPojos=oilListMapp.queryThreeFields(fieldName1,fieldValue1,fieldName2,fieldValue2,fieldName3,fieldValue3);
        return oilListPojos;

    }
}
